<?php
define('EmpireCMSAdmin','1');
require_once("../class/connect.php");
require_once("../class/db_sql.php");
require_once("../class/functions.php");
require_once("../class/user.php");
require_once("../class/say.php");
	$act_id=$_REQUEST["act_id"];
	$link=db_connect();
	$empire=new mysqlquery();
	$tb="phome_jat_act_registration";
	if($user_id){
		//DbDataAddOrEdit("",array(),array());
		$keyArea=array("uid"=>$user_id,"act_id"=>$act_id);
		$data	=array(
					"truename"=>$_REQUEST['truename'],
					"corporation"=>$_REQUEST['corporation'],
					"sex"=>$_REQUEST['sex'],
					"num"=>$_REQUEST['num'],
					"tel"=>$_REQUEST['tel'],
					"act_type"=>$_REQUEST['act_type'],
					"aid_person"=>$_REQUEST['aid_person'],
					"aid_tel"=>$_REQUEST['aid_tel'],
					"remark"=>$_REQUEST['remark'],
					"insurance_id"=>$_REQUEST['insurance_id'],
					"time"=>time(),
					"status"=>1
					);
		
		//print_r($keyArea);
		if(!emptyArrayTest($data,array("truename","sex","num","tel"))){
			echo json_encode(array("flag"=>-1,"msg"=>"请把信息填写完全！"));
			exit();
		}elseif(!DbTouch($tb,$keyArea)){
			$falg=DbDataAddOrEdit($tb,$data,$keyArea);
			if($falg){
				echo json_encode(array("flag"=>1,"msg"=>"ok"));
			}else{
				echo json_encode(array("flag"=>0,"msg"=>"数据库错误！"));
				exit();
			}
		}else{
			echo json_encode(array("flag"=>-2,"msg"=>"您已经报名，不能重复报名！"));
			exit();
		}
	}else{
		echo json_encode(array("flag"=>-1,"msg"=>"用户未登录！"));
		exit();
	}
	
?>